<?php

	/**
	 * @see Zend_View_Helper_Placeholder_Container_Standalone
	 */
	require_once 'Zend/View/Helper/Placeholder/Container/Standalone.php';	

	
	class Bike_View_Helper_BodyAttrs extends Zend_View_Helper_Placeholder_Container_Standalone
	{
	    const SEPARATOR = ' ';
	    const INDENT = ' ';

	    protected $_regKey = __CLASS__;

	    public function getSeparator()
	    {	    	$separator = parent::getSeparator();
	    	return ($separator) ? $separator : self::SEPARATOR;
	    }

	    public function getIndent()
	    {
	    	$indent = parent::getIndent();
	    	return ($indent) ? $indent : self::INDENT;
	    }

	    public function bodyAttrs()
	    {
		    $Args = func_get_args();
		    $argsCount = sizeof($Args);
		    if($argsCount)
		    {
		        $name = $Args[0];
		        $value = $Args[1];
		        if($argsCount == 2)
		        {
		        	$this->$name = $value;
		        }
		        elseif($argsCount == 1)
		        {
		        	if(is_array($name))
		        	{		        		foreach($name as $key => $val)
		        		{		        			$this->$key = $val;
		        		}
		        	}
		        	else
		        	{
		        		$this->__unset((string)$name);
		        	}
		        }
		  	}

       		return $this;
	    }

	    public function toString($indent = null)
	    {
	        $indent = (null !== $indent)
	                ? $this->getWhitespace($indent)
	                : $this->getIndent();

	        $items = array();
	        foreach ($this as $name => $value)
	        {
	                $items[] = $name.'="'.$value.'"';
	        }

	        $return = $indent.implode($this->getSeparator(), $items);
	        return $return;
	    }
	}
